#include "skytraq.h"
#include "subrip.h"
#include "unicsv.h"
+#include "wintec_tes.h"
#include "xcsv.h"
extern ff_vecs_t geo_vecs;
extern ff_vecs_t v900_vecs;
extern ff_vecs_t enigma_vecs;
extern ff_vecs_t teletype_vecs;
-extern ff_vecs_t wintec_tes_vecs;
extern ff_vecs_t format_garmin_xt_vecs;
extern ff_vecs_t mapbar_track_vecs;
extern ff_vecs_t f90g_track_vecs;
LegacyFormat teletype_fmt {teletype_vecs};
SkytraqfileFormat skytraq_ffmt;
MinihomerFormat miniHomer_fmt;
- LegacyFormat wintec_tes_fmt {wintec_tes_vecs};
+ WintecTesFormat wintec_tes_fmt;
SubripFormat subrip_fmt;
LegacyFormat format_garmin_xt_fmt {format_garmin_xt_vecs};
GarminFitFormat format_fit_fmt;
*/
-#include "defs.h"
+#include "wintec_tes.h"
-#define MYNAME "wintec_tes"
+#include <ctime> // for time_t, tm
+#include <cstring> // for memset
+
+#include "defs.h" // for Waypoint, mkgmtime, track_add_head, track_add_wpt, waypt_add, route_head
-static gbfile* fin;
-static void
-wintec_tes_rd_init(const QString& fname)
+#define MYNAME "wintec_tes"
+
+void
+WintecTesFormat::rd_init(const QString& fname)
{
fin = gbfopen(fname, "r", MYNAME);
}
-static void
-wintec_tes_rd_deinit()
+void
+WintecTesFormat::rd_deinit()
{
gbfclose(fin);
}
-static time_t
-wintec_date_to_time(uint32_t w)
+time_t
+WintecTesFormat::wintec_date_to_time(uint32_t w)
{
struct tm tm;
memset(&tm, 0, sizeof(tm));
return mkgmtime(&tm);
}
-static void
-wintec_tes_read()
+void
+WintecTesFormat::read()
{
auto* trk = new route_head;
track_add_head(trk);
track_add_wpt(trk, wpt);
}
}
-
-static
-QVector<arglist_t> wintec_tes_args = {
-};
-
-ff_vecs_t wintec_tes_vecs = {
- ff_type_file,
- {
- ff_cap_read /* waypoints */,
- ff_cap_read /* tracks */,
- ff_cap_none /* routes */
- },
- wintec_tes_rd_init,
- nullptr,
- wintec_tes_rd_deinit,
- nullptr,
- wintec_tes_read,
- nullptr,
- nullptr,
- &wintec_tes_args,
- CET_CHARSET_ASCII, 0 /* ascii is the expected character set */
- /* not fixed, can be changed through command line parameter */
- , NULL_POS_OPS,
- nullptr
-};
--- /dev/null
+/*
+
+ Wintec tes support.
+
+ Copyright (C) 2010 Robert Lipe, robertlipe+source@gpsbabel.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ */
+#ifndef WINTEC_TES_H_INCLUDED_
+#define WINTEC_TES_H_INCLUDED_
+
+#include <QString> // for QString
+#include <QVector> // for QVector
+
+#include <cstdint> // for uint32_t
+#include <ctime> // for time_t
+
+#include "defs.h" // for ff_cap, arglist_t, ff_cap_read, CET_CHARSET_ASCII, ff_cap_none, ff_type, ff_type_file
+#include "format.h" // for Format
+#include "gbfile.h" // for gbfile
+
+
+class WintecTesFormat : public Format
+{
+public:
+ QVector<arglist_t>* get_args() override
+ {
+ return &wintec_tes_args;
+ }
+
+ ff_type get_type() const override
+ {
+ return ff_type_file;
+ }
+
+ QVector<ff_cap> get_cap() const override
+ {
+ /* waypoints, tracks, routes */
+ return { ff_cap_read, ff_cap_read, ff_cap_none };
+ }
+
+ QString get_encode() const override
+ {
+ return CET_CHARSET_ASCII;
+ }
+
+ int get_fixed_encode() const override
+ {
+ return 0;
+ }
+
+ void rd_init(const QString& fname) override;
+ void read() override;
+ void rd_deinit() override;
+
+private:
+ /* Member Functions */
+
+ static time_t wintec_date_to_time(uint32_t w);
+
+ /* Data Members */
+
+ gbfile* fin{};
+
+ QVector<arglist_t> wintec_tes_args = {
+ };
+
+};
+#endif // WINTEC_TES_H_INCLUDED_